package com.koro.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.koro.annotation.Column;
import com.koro.annotation.ColumnComment;
import com.koro.annotation.Table;
import com.koro.constant.ScheduleConstants;
import com.koro.constants.MySqlTypeConstant;
import lombok.Data;

import java.util.Date;

@Data
@TableName("job_info")
@Table(name = "job_info", comment = "定时任务调度表")
public class JobInfo {


    @TableId(value = "job_id", type = IdType.AUTO)
    @Column(name = "job_id", type = MySqlTypeConstant.INT, length = 20, isKey = true, isAutoIncrement = true)
    @ColumnComment(value = "主键，自动递增")
    private Long jobId;


    @Column(name = "job_name", type = MySqlTypeConstant.VARCHAR, length = 64)
    @ColumnComment(value = "任务名称")
    private String jobName;


    @Column(name = "job_group", type = MySqlTypeConstant.VARCHAR, length = 64)
    @ColumnComment(value = "任务组名")
    private String jobGroup;


    @Column(name = "invoke_target", type = MySqlTypeConstant.VARCHAR, length = 500)
    @ColumnComment(value = "调用目标字符串")
    private String invokeTarget;

    /**
     * cron执行表达式
     */
    @Column(name = "cron_expression", type = MySqlTypeConstant.VARCHAR, length = 255)
    @ColumnComment(value = "cron执行表达式")
    private String cronExpression;


    @Column(name = "misfire_policy", type = MySqlTypeConstant.VARCHAR, length = 2)
    @ColumnComment(value = "cron计划策略")
    private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT;


    @Column(name = "concurrent", type = MySqlTypeConstant.VARCHAR, length = 2)
    @ColumnComment(value = "是否并发执行（0允许 1禁止）")
    private String concurrent;


    @Column(name = "status", type = MySqlTypeConstant.VARCHAR, length = 2)
    @ColumnComment(value = "任务状态（0正常 1暂停）")
    private String status;


    @Column(name = "remake", type = MySqlTypeConstant.VARCHAR, length = 128)
    @ColumnComment(value = "备注")
    private String remake;

    @Column(name = "create_time", type = MySqlTypeConstant.DATETIME)
    @ColumnComment(value = "添加时间")
    private Date createTime = new Date();

}

